<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            box-sizing: border-box;
            width: 500px;
            height: 300px;
            margin: 0 auto;
            font-size: 30px;
            text-align: center;
            background-color: pink;
            padding: 50px;
        }
    </style>
</head>

<body>
    <div>
        <p>随机点名</p>
        <button>开始</button>
    </div>
    <script>
        //随机点名
        let text = document.querySelector('p')
        let btn = document.querySelector('button')
        let getRandow = (min, max) => Math.floor(Math.random() * (max - min) + min);
        let arr = ['樱满集', '蝶祈', '恙神涯', '校条祭', '嘘界', '路飞', '娜美', '山治', '乔巴', '布鲁克', '罗宾', '弗兰迪', '鸣人', '佐助', '止水', '鼬',]
        btn.onclick = () => {
            //判断按钮文本是否为开始，是：改成结束，不是：改成开始
            btn.innerText = btn.innerText == '开始' ? '结束' : '开始'
            let timer = setInterval(() => {
                //判断当前按钮文本是否为开始，是：停止计时器
                if (btn.innerText == '开始') clearInterval(timer)
                text.innerText = arr[getRandow(0, arr.length)]
            }, 100);
        }
    </script>
</body>

</html>